package com.gitee.dupe.authority.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.gitee.dolt.boot.mapper.SuperMapper;
import com.gitee.dupe.authority.entity.Resource;
import com.gitee.dupe.authority.enumeration.ResourceTypeEnum;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author LYH
 * @since 2020-06-30
 */
@Repository
public interface ResourceMapper extends SuperMapper<Resource> {

    IPage<Resource> selectPageWithParent(IPage page, @Param(Constants.WRAPPER) Wrapper<?> ew);

    /**
     * 获取用户权限
     *
     * @param userId
     * @return
     */
    List<Resource> findAllEnabledByUserId(@Param("userId") Long userId);

    /**
     * 获取角色权限
     *
     * @param roleId
     * @return
     */
    List<Resource> findAllByRoleId(@Param("roleId") Long roleId);
}
